<?php
require_once '../include/conn.php';
require_once 'header.php';

if($clause == "editinfo"){
    if($userName == '' && $passWord == ''){HintAndBack("至少修改一项",1);}

    if($userName != '')
	{
        $userName = substr(md5(sha1(md5($userName))),3);

    }
    
	if($passWord != '')
	{
        $passWord = substr(md5(sha1(md5($passWord))),3);
    
	}
    
    if($userName != '' && $passWord == ''){
        $query = "update `h_kefu_config` SET h_admin = '$userName'";
	    $db->query($query);
    }
    if($userName == '' && $passWord != ''){
        $query = "update `h_kefu_config` SET h_pass = '$passWord'";
	    $db->query($query);
    }
    if($userName != '' && $passWord != ''){
        $query = "update `h_kefu_config` SET h_admin = '$userName' , h_pass = '$passWord'";
	    $db->query($query);
    }
	
	okinfo('?','管理员修改成功！');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>账号管理</title>
    <link rel="stylesheet" href="index.css">
</head>
<body>
    <div class="form-list">
        <form action="?clause=editinfo" method="post">
            <div class="table-title">账号管理</div>
            <div class="table-list">
                <label>账号：</label>
                <input type="text" name="userName" maxlength="20"><span>*不修改为空</span>
            </div>
            <div class="table-list">
                <label>密码：</label>
                <input type="password" name="passWord" maxlength="20"><span>*不修改为空</span>
            </div>
            <div class="btn">
                <button class="text-center">确定修改</button>
            </div>
        </form>
    </div>
</body>
</html>